#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 1e5 + 10;

int n;
int q[N];

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);

    int T;
    scanf("%d", &T);
    while(T--){
        scanf("%d", &n);
        for(int i = 1; i <= n; i ++) scanf("%d", &q[i]);
        int cnt = n - 1;
        if(cnt == 0){
            printf("%d\n", n - 1);
            continue;
        }
        printf("%d\n", n - 1);
        printf("1 %d\n", n);
        int ctype = 0;
        if(q[1] % 2 == q[n] % 2){
            ctype = q[1] % 2;
        }else{
            if((q[1] + q[n]) % 2){
                ctype = q[1] % 2;
                cnt ++;
            }else{
                ctype = q[n] % 2;
                cnt ++;
            }
        }

        for(int i = 2; i <= n - 1; i ++){
            if((q[i] + ctype) % 2){
                printf("%d %d\n", 1, i);
            }else{
                printf("%d %d\n", i, n);
            }
        }

    }

    return 0;
}